<html>
	<head>
		<title>无聊的夜晚</title>
		<meta charset="utf-8">
	</head>
	<body>
		<input type="text" class="url"><br>
		<input type="button" class="req" value="在上面填贴图库url&确定&裁剪&双击确定"><br>
		<img class="tocut" src="">
		<script type="text/javascript" src='./static/js/jquery.min.js'></script>
		<script type="text/javascript" src='./static/js/jquery.Jcrop.min.js'></script>
		<script type="text/javascript">
		$(document).ready(function() {
			var cut_type = {};
			$('.req').click(function() {
				var url = $('.url').val()
				cut_type['url'] = url
				$('.tocut').attr('src', url)
				jcrop_api = $.Jcrop('.tocut',{
					onSelect  : updateCoords,
					onDblClick: send_cut
				})

			});
			function updateCoords(c) {
				cut_type["x"] = c.x
				cut_type["y"] = c.y
				cut_type["w"] = c.w
				cut_type["h"] = c.h
			}
			function send_cut() {
				$.ajax({
					url : 'del.php',
					type : 'post',
					data: cut_type,
					dataType: 'json',
					success: function(data){
						alert('ok');
						$('.tocut').attr('src', '')
						$('.url').val('')
					}
				})
			}
		})
		</script>
	</body>
</html>